#define _CRT_SECURE_NO_WARNINGS 1
#include "AVLTree.h"
#include <iostream>
#include <vector>
using namespace std;

void TestAVLTree1()
{
	//int a[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
	int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	AVLTree<int> t;
	for (auto e : a)
	{
		if (e == 14)
		{
			int x = 0;
		}

		t.Insert(e);
		cout << e << "->" << t.IsAVLTree() << endl;
	}

	t.InOrder();
	cout << endl;
	cout << t.IsAVLTree() << endl;
}

void TestAVLTree2()
{
	const int N = 100000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));

	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand() + i);
		//cout << v.back() << endl;
	}

	AVLTree<int> t;
	for (auto e : v)
	{
		t.Insert(e);
		//cout << "Insert:" << e << "->" << t.IsAVLTree() << endl;
	}
	cout << t.IsAVLTree() << endl;
}
int main()
{
	TestAVLTree1();
	TestAVLTree2();
	return 0;
}